# Create your views here.
#coding=utf-8

from models import shop


def match_shop(activityname):
    count=shop.objects.filter(shopkeys__icontains=activityname).count()
    if count<=3:
        shops=shop.objects.filter(shopkeys__icontains=activityname).values('id','shopname','shopaddress','shopimage')
    else:
        shops=shop.objects.filter(shopkeys__icontains=activityname).values('id','shopname','shopaddress','shopimage')[0:3]
    return shops